home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / NDK / NDK_3.5 / Include / include_i / libraries / gadtools.i < prev    next >
Encoding:
Text File  |  1999-10-20  |  14.8 KB  |  427 lines

  1.     IFND LIBRARIES_GADTOOLS_I
  2. LIBRARIES_GADTOOLS_I    SET    1
  3. **
  4. **    $VER: gadtools.i 39.12 (24.8.1993)
  5. **    Includes Release 44.1
  6. **
  7. **    gadtools.library definitions
  8. **
  9. **    (C) Copyright 1989-1999 Amiga, Inc.
  10. **    All Rights Reserved.
  11. **
  12.  
  13. *------------------------------------------------------------------------*
  14.  
  15.     IFND EXEC_TYPES_I
  16.     INCLUDE "exec/types.i"
  17.     ENDC
  18.  
  19.     IFND UTILITY_TAGITEM_I
  20.     INCLUDE "utility/tagitem.i"
  21.     ENDC
  22.  
  23.     IFND INTUITION_INTUITION_I
  24.     INCLUDE "intuition/intuition.i"
  25.     ENDC
  26.  
  27.     IFND INTUITION_GADGETCLASS_I
  28.     INCLUDE "intuition/gadgetclass.i"
  29.     ENDC
  30.  
  31. *------------------------------------------------------------------------*
  32.  
  33. * The kinds (almost classes) of gadgets that GadTools supports.
  34. * Use these identifiers when calling CreateGadgetA()
  35.  
  36. GENERIC_KIND    EQU    0
  37. BUTTON_KIND    EQU    1
  38. CHECKBOX_KIND    EQU    2
  39. INTEGER_KIND    EQU    3
  40. LISTVIEW_KIND    EQU    4
  41. MX_KIND        EQU    5
  42. NUMBER_KIND    EQU    6
  43. CYCLE_KIND    EQU    7
  44. PALETTE_KIND    EQU    8
  45. SCROLLER_KIND    EQU    9
  46. * Kind number 10 is reserved
  47. SLIDER_KIND    EQU    11
  48. STRING_KIND    EQU    12
  49. TEXT_KIND    EQU    13
  50.  
  51. NUM_KINDS    EQU    14
  52.  
  53. *------------------------------------------------------------------------*
  54.  
  55. * 'Or' the appropriate set together for your Window IDCMPFlags: *
  56.  
  57. ARROWIDCMP    EQU    IDCMP_GADGETUP!IDCMP_GADGETDOWN!IDCMP_INTUITICKS!IDCMP_MOUSEBUTTONS
  58.  
  59. BUTTONIDCMP    EQU    IDCMP_GADGETUP
  60. CHECKBOXIDCMP    EQU    IDCMP_GADGETUP
  61. INTEGERIDCMP    EQU    IDCMP_GADGETUP
  62. LISTVIEWIDCMP    EQU    IDCMP_GADGETUP!IDCMP_GADGETDOWN!IDCMP_MOUSEMOVE!ARROWIDCMP
  63.  
  64. MXIDCMP        EQU    IDCMP_GADGETDOWN
  65. NUMBERIDCMP    EQU    0
  66. CYCLEIDCMP    EQU    IDCMP_GADGETUP
  67. PALETTEIDCMP    EQU    IDCMP_GADGETUP
  68.  
  69. * Use ARROWIDCMP!SCROLLERIDCMP if your scrollers have arrows: *
  70. SCROLLERIDCMP    EQU    IDCMP_GADGETUP!IDCMP_GADGETDOWN!IDCMP_MOUSEMOVE
  71. SLIDERIDCMP    EQU    IDCMP_GADGETUP!IDCMP_GADGETDOWN!IDCMP_MOUSEMOVE
  72. STRINGIDCMP    EQU    IDCMP_GADGETUP
  73.  
  74. TEXTIDCMP    EQU    0
  75.  
  76. *------------------------------------------------------------------------*
  77.  
  78. * Generic NewGadget used by several of the gadget classes: *
  79.  
  80.     STRUCTURE NewGadget,0
  81.  
  82.     WORD    gng_LeftEdge
  83.     WORD    gng_TopEdge    ; gadget position
  84.     WORD    gng_Width
  85.     WORD    gng_Height    ; gadget size
  86.     APTR    gng_GadgetText    ; gadget label
  87.     APTR    gng_TextAttr    ; desired font for gadget label
  88.     UWORD    gng_GadgetID    ; gadget ID
  89.     ULONG    gng_Flags    ; see below
  90.     APTR    gng_VisualInfo    ; Set to retval of GetVisualInfo()
  91.     APTR    gng_UserData    ; gadget UserData
  92.  
  93.     LABEL    gng_SIZEOF
  94.  
  95. * ng_Flags control certain aspects of the gadget.  The first five control
  96. * the placement of the descriptive text.  Each gadget kind has its default,
  97. * which is usually PLACETEXT_LEFT.  Consult the autodocs for details.
  98.  
  99. PLACETEXT_LEFT    EQU    $0001    * Right-align text on left side
  100. PLACETEXT_RIGHT    EQU    $0002    * Left-align text on right side
  101. PLACETEXT_ABOVE    EQU    $0004    * Center text above
  102. PLACETEXT_BELOW    EQU    $0008    * Center text below
  103. PLACETEXT_IN    EQU    $0010    * Center text on
  104.  
  105. NG_HIGHLABEL    EQU    $0020    * Highlight the label
  106.  
  107. *------------------------------------------------------------------------*
  108.  
  109. * Fill out an array of these and pass that to CreateMenus():
  110.  
  111.     STRUCTURE NewMenu,0
  112.  
  113.     UBYTE    gnm_Type        ; See below
  114.     UBYTE    gnm_Pad            ; alignment padding
  115.     APTR    gnm_Label        ; Menu's label
  116.     APTR    gnm_CommKey        ; MenuItem Command Key Equiv
  117.     UWORD    gnm_Flags        ; Menu or MenuItem flags (see note)
  118.     LONG    gnm_MutualExclude    ; MenuItem MutualExclude word
  119.     APTR    gnm_UserData        ; For your own use, see note
  120.  
  121.     LABEL    gnm_SIZEOF
  122.  
  123. * Needed only by inside IM_ definitions below */
  124. MENU_IMAGE    EQU    128
  125.  
  126. * nm_Type determines what each NewMenu structure corresponds to.
  127. * for the NM_TITLE, NM_ITEM, and NM_SUB values, nm_Label should
  128. * be a text string to use for that menu title, item, or sub-item.
  129. * For IM_ITEM or IM_SUB, set nm_Label to point at the Image structure
  130. * you wish to use for this item or sub-item.
  131. * NOTE: At present, you may only use conventional images.
  132. * Custom images created from Intuition image-classes do not work.
  133. NM_TITLE    EQU    1    * Menu header
  134. NM_ITEM        EQU    2    * Textual menu item
  135. NM_SUB        EQU    3    * Textual menu sub-item
  136.  
  137. IM_ITEM        EQU    NM_ITEM!MENU_IMAGE    * Graphical menu item
  138. IM_SUB        EQU    NM_SUB!MENU_IMAGE    * Graphical menu sub-item
  139.  
  140. * The NewMenu array should be terminated with a NewMenu whose
  141. * nm_Type equals NM_END.
  142. NM_END        EQU    0    * End of NewMenu array
  143.  
  144. * Starting with V39, GadTools will skip any NewMenu entries whose
  145. * nm_Type field has the NM_IGNORE bit set.
  146. NM_IGNORE    EQU    64
  147.  
  148.  
  149. * nm_Label should be a text string for textual items, a pointer
  150. * to an Image structure for graphical menu items, or the special
  151. * constant NM_BARLABEL, to get a separator bar.
  152. NM_BARLABEL    EQU    -1
  153.  
  154.  
  155. * The nm_Flags field is used to fill out either the Menu->Flags or
  156. * MenuItem->Flags field.  Note that the sense of the MENUENABLED or
  157. * ITEMENABLED bit is inverted between this use and Intuition's use,
  158. * in other words, NewMenus are enabled by default.  The following
  159. * labels are provided to disable them:
  160. NM_MENUDISABLED        EQU    MENUENABLED
  161. NM_ITEMDISABLED        EQU    ITEMENABLED
  162.  
  163. * New for V39:    NM_COMMANDSTRING.  For a textual MenuItem or SubItem,
  164. * point nm_CommKey at an arbitrary string, and set the NM_COMMANDSTRING
  165. * flag.
  166. NM_COMMANDSTRING    EQU    COMMSEQ
  167.  
  168. * The following are pre-cleared (COMMSEQ, ITEMTEXT, and HIGHxxx are set
  169. * later as appropriate):
  170. * Under V39, the COMMSEQ flag bit is not cleared, since it now has
  171. * meaning.
  172. NM_FLAGMASK        EQU    ~(COMMSEQ!ITEMTEXT!HIGHFLAGS)
  173. NM_FLAGMASK_V39        EQU    ~(ITEMTEXT!HIGHFLAGS)
  174.  
  175. * You may choose among CHECKIT, MENUTOGGLE, and CHECKED.
  176. * Toggle-select menuitems are of type CHECKIT!MENUTOGGLE, along
  177. * with CHECKED if currently selected.  Mutually exclusive ones
  178. * are of type CHECKIT, and possibly CHECKED too.  The nm_MutualExclude
  179. * is a bit-wise representation of the items excluded by this one,
  180. * so in the simplest case (choose 1 among n), these flags would be
  181. * ~1, ~2, ~4, ~8, ~16, etc.  See the Intuition Menus chapter.
  182.  
  183. * A UserData pointer can be associated with each Menu and MenuItem structure.
  184. * The CreateMenus() call allocates space for a UserData after each
  185. * Menu or MenuItem (header, item or sub-item).    You should use the
  186. * GTMENU_USERDATA or GTMENUITEM_USERDATA macro to extract it. */
  187.  
  188. GTMENU_USERDATA    MACRO
  189.         move.l    mu_SIZEOF(\1),\2
  190.         ENDM
  191.  
  192. GTMENUITEM_USERDATA    MACRO
  193.         move.l    mi_SIZEOF(\1),\2
  194.         ENDM
  195.  
  196. * Here is an old one for compatibility.  Do not use in new code!
  197. MENU_USERDATA    MACRO
  198.         move.l    mi_SIZEOF(\1),\2
  199.         ENDM
  200.  
  201.  
  202. * These return codes can be obtained through the GTMN_SecondaryError tag:
  203. GTMENU_TRIMMED    EQU    $00000001    ; Too many menus, items, or subitems,
  204.                     ; menu has been trimmed down
  205. GTMENU_INVALID    EQU    $00000002    ; Invalid NewMenu array
  206. GTMENU_NOMEM    EQU    $00000003    ; Out of memory
  207.  
  208.  
  209. *------------------------------------------------------------------------*
  210.  
  211. * Starting with V39, checkboxes and mx gadgets can be scaled to your
  212. * specified gadget width/height.  Use the new GTCB_Scaled or GTMX_Scaled
  213. * tags, respectively.  Under V37, and by default in V39, the imagery
  214. * is of the following fixed size:
  215.  
  216. * MX gadget default dimensions:
  217. MX_WIDTH    EQU    17
  218. MX_HEIGHT    EQU    9
  219.  
  220. * Checkbox default dimensions:
  221. CHECKBOX_WIDTH    EQU    26
  222. CHECKBOX_HEIGHT    EQU    11
  223.  
  224. *------------------------------------------------------------------------*
  225.  
  226. * Tags for GadTools functions:
  227.  
  228. GT_TagBase    EQU    TAG_USER+$80000 ; Begin counting tags
  229.  
  230. GTVI_NewWindow    EQU    GT_TagBase+1    ; NewWindow struct for GetVisualInfo
  231. GTVI_NWTags    EQU    GT_TagBase+2    ; NWTags for GetVisualInfo
  232.  
  233. GT_Private0    EQU    GT_TagBase+3    ; (private)
  234.  
  235. GTCB_Checked    EQU    GT_TagBase+4    ; State of checkbox
  236.  
  237. GTLV_Top    EQU    GT_TagBase+5    ; Top visible one in listview
  238. GTLV_Labels    EQU    GT_TagBase+6    ; List to display in listview
  239. GTLV_ReadOnly    EQU    GT_TagBase+7    ; TRUE if listview is to be read-only
  240. GTLV_ScrollWidth    EQU    GT_TagBase+8    ; Width of scrollbar
  241.  
  242. GTMX_Labels    EQU    GT_TagBase+9    ; NULL-terminated array of labels
  243. GTMX_Active    EQU    GT_TagBase+10    ; Active one in mx gadget
  244.  
  245. GTTX_Text    EQU    GT_TagBase+11    ; Text to display
  246. GTTX_CopyText    EQU    GT_TagBase+12    ; Copy text label instead of referencing it
  247.  
  248. GTNM_Number    EQU    GT_TagBase+13    ; Number to display
  249.  
  250. GTCY_Labels    EQU    GT_TagBase+14    ; NULL-terminated array of labels
  251. GTCY_Active    EQU    GT_TagBase+15    ; The active one in the cycle gad
  252.  
  253. GTPA_Depth    EQU    GT_TagBase+16    ; Number of bitplanes in palette
  254. GTPA_Color    EQU    GT_TagBase+17    ; Palette color
  255. GTPA_ColorOffset    EQU    GT_TagBase+18    ; First color to use in palette
  256. GTPA_IndicatorWidth    EQU    GT_TagBase+19    ; Width of current-color indicator
  257. GTPA_IndicatorHeight    EQU    GT_TagBase+20    ; Height of current-color indicator
  258.  
  259. GTSC_Top    EQU    GT_TagBase+21    ; Top visible in scroller
  260. GTSC_Total    EQU    GT_TagBase+22    ; Total in scroller area
  261. GTSC_Visible    EQU    GT_TagBase+23    ; Number visible in scroller
  262. GTSC_Overlap    EQU    GT_TagBase+24    ; Unused
  263.  
  264. * GT_TagBase+25 through GT_TagBase+37 are reserved
  265.  
  266. GTSL_Min    EQU    GT_TagBase+38    ; Slider min value
  267. GTSL_Max    EQU    GT_TagBase+39    ; Slider max value
  268. GTSL_Level    EQU    GT_TagBase+40    ; Slider level
  269. GTSL_MaxLevelLen    EQU    GT_TagBase+41    ; Max length of printed level
  270. GTSL_LevelFormat    EQU    GT_TagBase+42    ; Format string for level
  271. GTSL_LevelPlace    EQU    GT_TagBase+43    ; Where level should be placed
  272. GTSL_DispFunc    EQU    GT_TagBase+44    ; Callback for number calculation before display
  273.  
  274. GTST_String    EQU    GT_TagBase+45    ; String gadget's displayed string
  275. GTST_MaxChars    EQU    GT_TagBase+46    ; Max length of string
  276.  
  277. GTIN_Number    EQU    GT_TagBase+47    ; Number in integer gadget
  278. GTIN_MaxChars    EQU    GT_TagBase+48    ; Max number of digits
  279.  
  280. GTMN_TextAttr    EQU    GT_TagBase+49    ; MenuItem font TextAttr
  281. GTMN_FrontPen    EQU    GT_TagBase+50    ; MenuItem text pen color
  282.  
  283. GTBB_Recessed    EQU    GT_TagBase+51    ; Make BevelBox recessed
  284.  
  285. GT_VisualInfo    EQU    GT_TagBase+52    ; result of VisualInfo call
  286.  
  287. GTLV_ShowSelected    EQU    GT_TagBase+53    ; show selected entry beneath listview,
  288.              ; set tag data = NULL for display-only, or pointer
  289.             ; to a string gadget you've created
  290. GTLV_Selected    EQU    GT_TagBase+54    ; Set ordinal number of selected entry in the list
  291. GT_Reserved1    EQU    GT_TagBase+56    ; Reserved for future use
  292.  
  293. GTTX_Border    EQU    GT_TagBase+57    ; Put a border around Text-display gadgets
  294. GTNM_Border    EQU    GT_TagBase+58    ; Put a border around Number-display gadgets
  295.  
  296. GTSC_Arrows    EQU    GT_TagBase+59    ; Specify size of arrows for scroller
  297. GTMN_Menu    EQU    GT_TagBase+60    ; Pointer to Menu for use by
  298.             ; LayoutMenuItems()
  299. GTMX_Spacing    EQU    GT_TagBase+61    ; Added to font height to
  300.             ; figure spacing between mx choices.  Use this
  301.             ; instead of LAYOUTA_SPACING for mx gadgets.
  302.  
  303. * New to V37 GadTools.    Ignored by GadTools V36.
  304. GTMN_FullMenu    EQU    GT_TagBase+62  ; Asks CreateMenus() to
  305.         ; validate that this is a complete menu structure
  306. GTMN_SecondaryError    EQU    GT_TagBase+63  ; ti_Data is a pointer
  307.         ; to a ULONG to receive error reports from CreateMenus()
  308. GT_Underscore    EQU    GT_TagBase+64    ; ti_Data points to the symbol
  309.         ; that preceeds the character you'd like to underline in a
  310.         ; gadget label
  311. GTST_EditHook    EQU    GT_TagBase+55    ; String EditHook
  312. GTIN_EditHook    EQU    GTST_EditHook    ; Same thing, different name,
  313.         ; just to round out INTEGER_KIND gadgets
  314.  
  315.  
  316. * New to V39 GadTools.  Ignored by GadTools V36 and V37
  317. GTMN_Checkmark    EQU    GT_TagBase+65    ; ti_Data is checkmark img to use
  318. GTMN_AmigaKey    EQU    GT_TagBase+66    ; ti_Data is Amiga-key img to use
  319. GTMN_NewLookMenus    EQU    GT_TagBase+67 ; ti_Data is boolean
  320.  
  321. * New to V39 GadTools.  Ignored by GadTools V36 and V37.
  322. * Set to TRUE if you want the checkbox or mx image scaled to
  323. * the gadget width/height you specify.  Defaults to FALSE,
  324. * for compatibility.
  325. GTCB_Scaled    EQU    GT_TagBase+68    ; ti_Data is boolean
  326. GTMX_Scaled    EQU    GT_TagBase+69    ; ti_Data is boolean
  327.  
  328. GTPA_NumColors    EQU    GT_TagBase+70    ; Number of colors in palette
  329.  
  330. GTMX_TitlePlace      EQU GT_TagBase+71      ; Where to put the title
  331.  
  332. GTTX_FrontPen        EQU GT_TagBase+72      ; Text color in TEXT_KIND gad
  333. GTTX_BackPen         EQU GT_TagBase+73      ; Bgrnd color in TEXT_KIND gad
  334. GTTX_Justification   EQU GT_TagBase+74      ; See GTJ_#? constants
  335.  
  336. GTNM_FrontPen        EQU GT_TagBase+72      ; Text color in NUMBER_KIND gad
  337. GTNM_BackPen         EQU GT_TagBase+73      ; Bgrnd color in NUMBER_KIND gad
  338. GTNM_Justification   EQU GT_TagBase+74      ; See GTJ_#? constants
  339. GTNM_Format          EQU GT_TagBase+75      ; Formatting string for number
  340. GTNM_MaxNumberLen    EQU GT_TagBase+76      ; Maximum length of number
  341.  
  342. GTBB_FrameType       EQU GT_TagBase+77      ; defines what kind of boxes
  343.                                             ; DrawBevelBox() renders. See
  344.                                             ; the BBFT_#? constants for
  345.                                             ; possible values
  346.  
  347. GTLV_MakeVisible     EQU GT_TagBase+78      ; Make this item visible
  348.  
  349. GTSL_MaxPixelLen     EQU GT_TagBase+80      ; Max pixel size of level display
  350. GTSL_Justification   EQU GT_TagBase+81      ; how should the level be displayed
  351.  
  352. GTPA_ColorTable      EQU GT_TagBase+82      ; colors to use in palette
  353.  
  354. GTTX_Clipped         EQU GT_TagBase+85         ; make a TEXT_KIND clip text
  355. GTNM_Clipped         EQU GT_TagBase+85         ; make a NUMBER_KIND clip text
  356.  
  357. * Old definition, now obsolete:
  358. GT_Reserved0    EQU    GTST_EditHook
  359.  
  360. *------------------------------------------------------------------------*
  361.  
  362. * Justification types for GTTX_Justification and GTNM_Justification tags *
  363. GTJ_LEFT   EQU 0
  364. GTJ_RIGHT  EQU 1
  365. GTJ_CENTER EQU 2
  366.  
  367. *------------------------------------------------------------------------*
  368.  
  369. * Bevel box frame types for GTBB_FrameType tag
  370. BBFT_BUTTON     EQU 1  * Standard button gadget box
  371. BBFT_RIDGE     EQU 2  * Standard string gadget box
  372. BBFT_ICONDROPBOX EQU 3  * Standard icon drop box
  373.  
  374. *------------------------------------------------------------------------*
  375.  
  376. * Typical suggested spacing between "elements": *
  377. INTERWIDTH    EQU    8
  378. INTERHEIGHT    EQU    4
  379.  
  380. *------------------------------------------------------------------------*
  381.  
  382. * "NWay" is an old synonym for cycle gadgets
  383.  
  384. NWAY_KIND    EQU    CYCLE_KIND
  385. NWAYIDCMP    EQU    CYCLEIDCMP
  386.  
  387. GTNW_Labels    EQU    GTCY_Labels
  388. GTNW_Active    EQU    GTCY_Active
  389.  
  390. *------------------------------------------------------------------------*
  391.  
  392. * These two definitions are obsolete, but are here for backwards
  393. * compatibility.  You never need to worry about these:
  394. GADTOOLBIT    EQU    $8000
  395.  
  396. * Use this mask to isolate the user part: *
  397. GADTOOLMASK    EQU    ~GADTOOLBIT
  398.  
  399. *------------------------------------------------------------------------*
  400.  
  401. * These definitions are for the GTLV_CallBack tag
  402.  
  403. * The different types of messages that a listview callback hook can see
  404. LV_DRAW             equ $202    ; draw yourself, with state
  405.  
  406. * Possible return values from a callback hook
  407. LVCB_OK              equ 0    ; callback understands this message type
  408. LVCB_UNKNOWN         equ 1    ; callback does not understand this message
  409.  
  410. * states for LVDrawMsg.lvdm_State
  411. LVR_NORMAL         equ 0      ; the usual
  412. LVR_SELECTED         equ 1    ; for selected gadgets
  413. LVR_NORMALDISABLED   equ 2    ; for disabled gadgets
  414. LVR_SELECTEDDISABLED equ 8    ; disabled and selected
  415.  
  416. * structure of LV_DRAW messages, object is a (struct Node *)
  417.    STRUCTURE LVDrawMsg,0
  418.     ULONG    lvdm_MethodID        ; LV_DRAW
  419.     APTR    lvdm_RastPort        ; where to render to
  420.     APTR    lvdm_DrawInfo        ; useful to have around
  421.     STRUCT  lvdm_Bounds,ra_SIZEOF   ; limits of where to render
  422.     ULONG    lvdm_State        ; how to render
  423.  
  424. *------------------------------------------------------------------------*
  425.  
  426.     ENDC
  427.